home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_1199 / 1669 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  2.8 KB

  1. From: Stephan Haslbeck <haslbecs@informatik.tu-muenchen.de>
  2. Subject: Sticky Text Patches
  3. Date:     Fri, 1 Jul 1994 13:55:38 +0200
  4. Mime-Version: 1.0
  5. Message-Id: <94Jul1.125546mesz.209301@hphalle0.informatik.tu-muenchen.de>
  6.  
  7. Michael Hohmuth writes:
  8.  
  9. > itschere@techfak.uni-bielefeld.de writes:
  10. >
  11. > > > I've put up a fourth re-sync patch...
  12. > > 
  13. > >  Fine... Only a pity that it gives me nothing but memory violations... :-(
  14. >
  15. > I've successfully been using this version for a few days on a Mega
  16. > ST..  Perhaps this is something 030 specific?
  17.                   ^^^
  18.                  
  19. It is!  I had memory violations on my falcon, too. The problem is
  20. that when do_vfork tries to restore the parent's memory it does
  21. not have access to it anymore.
  22.  
  23. So I added some prot_temp()-calls in fork_restore(), and now it 
  24. works fine. I've marked the lines below (Sorry, no diff, because I
  25. don't know (yet) how to use it).
  26.  
  27. It is a working solution - but I don't know whether it's the best.
  28.  
  29.  
  30. /*
  31.  * fork_restore(p): restore process memory after a blocking fork
  32.  */
  33.  
  34. void fork_restore(p, savemem)
  35. PROC *p;
  36. MEMREGION *savemem;
  37. {
  38.     MEMREGION *m;
  39.     long txtsize = p->txtsize;
  40.     char *saveplace;
  41.     int i;
  42. >>>    int cookie, cookie2; /* SH */
  43.  
  44.     if (!savemem) {
  45.         for (i = 0; i < p->num_reg; i++) {
  46.             m = p->mem[i];
  47.             if (m && (m->mflags & M_FSAVED)) {
  48.                 savemem = m;
  49.                 break;
  50.             }
  51.         }
  52.         if (!savemem)
  53.             return;
  54.     }
  55.     saveplace = (char *)savemem->loc;
  56.  
  57. >>>    /* SH: need to have global access to restore parent's memory */
  58. >>>    cookie = prot_temp(savemem->loc, savemem->len, -1);
  59.  
  60.     TRACE(("do_vfork: parent restoring memory"));
  61.     for (i = 0; i < p->num_reg; i++) {
  62.         m = p->mem[i];
  63.         if (m && !(m->mflags & (M_FSAVED|M_SHTEXT))) {
  64.             if (i != 1 || txtsize == 0) {
  65. >>>                cookie2 = prot_temp(m->loc, m->len, -1); /* SH */
  66.                 quickmove((char *)m->loc, saveplace, m->len);
  67.                 saveplace += m->len;
  68. >>>                (void) prot_temp(m->loc, m->len, cookie2); /* SH */
  69.             }
  70.             else {
  71. >>>                cookie2 = prot_temp(m->loc + txtsize, 
  72.                         m->len - txtsize, -1); /* SH */
  73.                 quickmove((char *)m->loc+txtsize, saveplace,
  74.                 m->len - txtsize);
  75.                 saveplace += m->len - txtsize;
  76. >>>                (void) prot_temp(m->loc + txtsize,
  77.                          m->len - txtsize, cookie2); /* SH */
  78.             }
  79.         }
  80.     }
  81. >>>    /* SH: do we have to restore access rights? */
  82. >>>    (void) prot_temp(savemem->loc, savemem->len, cookie);
  83.  
  84.     detach_region(p, savemem);
  85. }
  86.  
  87.  
  88. Ciao,
  89. Stephan
  90.  
  91.  
  92. P.S. This is the first time I mail to this list, so tell me if I did
  93.      something wrong.
  94.  
  95.  
  96. -- 
  97. +------------------------------+-----------------------------+
  98. |      Stephan Haslbeck           |    Fachbereich Informatik   |
  99. |       Agricolastr. 61           |   Technische Universitaet   |
  100. |      D-80686 Muenchen           |      Muenchen, Bayern         |
  101. +------------------------------+-----------------------------+
  102. |Motto: Es gibt keine Probleme,|
  103. |        nur Loesungen.           |
  104. +------------------------------+
  105.